<template>
  <van-tab title="即将上映" name="soonMovie" to="/films/soon">
    <div
      class="movieItem"
      v-for="item of comingSoon"
      :key="item._id"
      @click="goDetail"
    >
      <div class="itemLeft">
        <img :src="item.pic" alt="" />
        <div class="movieContent">
          <p class="title">{{ item.title }}</p>
          <p>
            观众评分 <span class="rating">{{ item.rating }}</span>
          </p>
          <p class="slogo">{{ item.slogo }}</p>
          <p>
            <span>{{ item.labels[1] }}</span> |
            <span>{{ item.evaluate }}</span>
          </p>
        </div>
      </div>
      <div class="wantbuy">
        <button class="buy">购票</button>
      </div>
    </div>
  </van-tab>
</template>

<script>
export default {
  data() {
    return {
      comingSoon: [],
    };
  },
  mounted() {
    this.$http(`http://122.112.161.135:4000/api/movie/comingSoon`).then((res) => {
      this.comingSoon = res.data.res;
    });
  },
  methods: {
    goDetail(id) {
      this.$router.push(`/film/${id}`);
    },
    beforeChange(){
        console.log(1);
    //   this.$router.push("/films/soon");
    },
  },
};
</script>

<style>
</style>